home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / turbo_tk.arc / IODEM.PAS < prev    next >
Pascal/Delphi Source File  |  1988-02-01  |  5KB  |  147 lines

  1. Program Illustrating_Screen_Editing;
  2.  
  3. uses CRT, FastTTT, DOS, WinTTT, KeyTTT, MenuTTT, IOTTT;
  4.  
  5. var
  6. Str1,
  7. Str2,
  8. Str3,
  9. Str4,
  10. Str5,
  11. Str6,
  12. Str7,
  13. Str8 : string;
  14. Code : integer;
  15. Ch : char;
  16.  
  17. Procedure Display_Options(var Str :string);
  18. var
  19.   M : Menu_Record;
  20.   Pick, Retcode : integer;
  21. const
  22.     T1 = 'Amoco';
  23.     T2 = 'Conoco';
  24.     T3 = 'Texaco';
  25.     T4 = 'Technoco';
  26. begin
  27.     With M do
  28.     begin
  29.         Heading1 := '';
  30.         Heading2 := '';
  31.         Topic[1] := T1;
  32.         Topic[2] := T2;
  33.         Topic[3] := T3;
  34.         Topic[4] := T4;
  35.         TotalPicks := 4;
  36.         PicksperLine := 1;
  37.         Addprefix := 0;
  38.         Margins := 0;
  39.         TopLeftXY[1] := 65;
  40.         TopLeftXy[2] := 5;
  41.         BoxType := 1;
  42.         AllowEsc := true;
  43.         Colors[1] := lightgray;
  44.         Colors[2] := black;
  45.         Colors[3] := black;
  46.         Colors[4] := lightgray;
  47.         Colors[5] := white;
  48.     end; {with M}
  49.     Pick := 1;
  50.     WriteAT(62,7,white,lightgray,'<--');
  51.     DisplayMenu(M,true,Pick,retcode);
  52.     WriteAT(62,7,white,lightgray,'   ');
  53.     If Retcode <> 0 then
  54.        Str := ''
  55.     else
  56.        Case Pick of
  57.        1 : Str := T1;
  58.        2 : Str := T2;
  59.        3 : Str := T3;
  60.        4 : Str := T4;
  61.        end; {Case}
  62. end; {Proc Display_Options}
  63.  
  64. {$F+}                      {must be defined as far}
  65. Procedure Special_Keys(Ch: Char; FieldID : integer;var ReturnStr: string);
  66. {you can define additional keystrokes to perform other no-standard IO operations
  67.  such as field-sensitive help, defined input procs etc. This is a replacement for
  68.  IOHELPPROC in TTT 3.0.
  69.  
  70.  In this example we will define the F1 key to display a company list if the
  71.  Field ID is  2}
  72. begin
  73.     If (Ch =  #187) and (FieldID = 2) then
  74.       Display_Options(ReturnStr);
  75. end;
  76. {F-}
  77.  
  78. begin             {test program}
  79. Str1 := '';
  80. Str2 := '';
  81. Str3 := '';
  82. Str4 := '';
  83. Str5 := '';
  84. Str6 := 'TX';
  85. Str7 := '';
  86. Str8 := '';
  87.  
  88. IO_Setfields(8);
  89.  
  90. IO_UserHook := @Special_Keys;
  91. IO_SetColors(15,4,11,1,14,4);
  92. IO_SoundBeeper(false);
  93. IO_AllowEsc(True);
  94. IO_DefineStr(1,  1,2,1,2, 30,6,Str1,'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');{name}
  95. IO_DefineStr(2,  1,3,1,3, 30,7,Str2,'*******************************');{Co.}
  96. IO_DefineStr(3,  2,4,2,4, 30,8,Str3,'*******************************');{ad1}
  97. IO_DefineStr(4,  3,5,3,5, 30,9,Str4,'*******************************');{ad2}
  98. IO_DefineStr(5,  4,6,4,6, 30,10,Str5,'@@@@@@@@@@@@@@@@');{city}
  99. IO_DefineStr(6,  4,7,5,7, 55,10,Str6,'!!');{state}
  100. IO_DefineStr(7,  4,8,6,8, 65,10,Str7,'#####-####');{zip}
  101. IO_DefineStr(8,  5,1,7,1, 30,12,Str8,'(###) ###-####'); {work Phone}
  102. IO_DefineMsg(1, 0,25,'Name is automatically set to capitals');
  103. IO_DefineMsg(2, 0,25,'Enter Company Name, press F1 for a list of companies');
  104. IO_DefineMsg(5, 0,25,'Now you can only type alphas and punctuation');
  105. IO_DefineMsg(6, 0,25,'Default is set to Texas');
  106. IO_DefineMsg(7, 0,25,'Zip and phone number must be numeric');
  107.  
  108. ClearText(1,1,80,25,red,lightgray);
  109. Box(1,1,80,25,red,lightgray,3);
  110. WriteCenter(2,blue,lightgray,'TechnoJocks Turbo Toolkit');
  111. WriteCenter(3,white,lightgray,'Screen Input Routines Demonstration');
  112. WriteAT(12,6,blue,lightgray,'Incumbents Name =>');
  113. WriteAT(20,7,blue,lightgray,'Company =>');
  114. WriteAT(20,8,blue,lightgray,'Address =>');
  115. WriteAT(23,10,blue,lightgray,'City =>');
  116. WriteAT(48,10,blue,lightgray,'State');
  117. WriteAT(60,10,blue,lightgray,'Zip');
  118. WriteAT(23,12,blue,lightgray,'Phone =>');
  119. WriteAT(10,16,white,lightgray,'Instructions:   [End to quit]');
  120. WriteAT(10,17,blue,lightgray,'This is a mock up of a data entry screen. Simply');
  121. WriteAT(10,18,blue,lightgray,'enter some values and press enter. Use the arrow');
  122. WriteAT(10,19,blue,lightgray,'keys to move between fields. Note the following:');
  123. WriteAT(10,20,white,lightgray,'End    to finish entry           Ins    toggle insert on and off');
  124. WriteAT(10,21,white,lightgray,'Alt-D  delete current field      Alt-E  delete all fields');
  125. WriteAT(10,22,white,lightgray,'Ctrl-Right  shift right          Ctrl-Left shift left');
  126. WriteAT(10,23,white,lightgray,'Tab         shift right          Shift-Tab shift left');
  127.  
  128. IO_Edit(Code);
  129. IO_ResetFields;
  130. Clrscr;
  131. If Code <> 0 then
  132.    WriteAT(1,1,white,black,'You escaped!')
  133. else
  134. begin
  135.     WriteAT(1,1,lightgray,black,'Address: '+Str1);
  136.     WriteAT(1,2,lightgray,black,'         '+Str2);
  137.     WriteAT(1,3,lightgray,black,'         '+Str3);
  138.     WriteAT(1,4,lightgray,black,'         '+Str4);
  139.     WriteAT(1,5,lightgray,black,'City: '+Str5);
  140.     WriteAT(1,6,lightgray,black,'State: '+Str6);
  141.     WriteAT(1,7,lightgray,black,'Zip: '+Str7);
  142. end;
  143. WriteAT(1,24,white,black,'Run DemoTTT.exe for the main demo program');
  144. WriteAT(1,25,white,black,'Technojocks Turbo Toolkit v4.0');
  145. Ch := Readkey;
  146. end.
  147.